package physics;

import java.io.Serializable;

public class Location implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private double x;
	private double y;
	public Location() {
		this(0d,0d);
	}
	public Location(double x,double y) {
		this.x = x;
		this.y = y;
	}
	public double getX() {
		return x;
	}
	public double getY() {
		return y;
	}
	public Location addVector(Vector v) {
		return new Location(x+v.getXMag(),y+v.getYMag());
	}
	public double distanceTo(Location loc1){
		double xDist = loc1.getX() - x; 
		double yDist = loc1.getY() - y;
		double distance = Math.sqrt(Math.pow(xDist, 2) + Math.pow(yDist, 2));
		return distance;
	}
	public String toString() {
		return "("+x+","+y+")";
	}
	public double angleTo(Location loc){
		double xDiff = loc.getX() - getX();
		double yDiff = loc.getY() - getY();
		return Math.atan2(yDiff, xDiff);
	}
}
